package com.google.code.jwebannotation;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.code.jwebannotation.annotation.HttpMethod;
import com.google.code.jwebannotation.annotation.Request;

public class WebAnnotation {

	public static String VERSION;
	
	static {
		try {
			VERSION = WebAnnotation.class.getPackage().getImplementationVersion();
			if (VERSION == null){
				VERSION = "UNKNOWN";
			}
		} catch (Exception e){
			VERSION = "UNKNOWN";
		}
	}
	
	@Request(page="/jWebAnnotation.do", method=HttpMethod.ALL)
	public String handleLogin(HttpServletRequest request, HttpServletResponse response)
		throws IOException {
		response.getOutputStream().write(("jWebAnnotation version "+ VERSION).getBytes());
		return null;
	}
	
}
